<template>
    <div style="width:60%;padding:0 2%">
        <!-- 实习经历 -->
         <h1 class="name"><i class="el-icon-arrow-left back11" @click="goback()"></i>添加实习经历</h1>
         <el-form ref="form" :model="form" label-width="80px">
            <el-row>
               <el-col :span="12">
                    <el-form-item label="公司名称" style="width:98%;">
                     <el-input v-model="form.companyname" placeholder="请输入公司名称"></el-input>
                    </el-form-item>
               </el-col>
               <el-col :span="12">
                   <el-form-item label="所属行业" style="width:98%;">
                    <el-input v-model="form.industry" placeholder="请输入所属行业"></el-input>
                   </el-form-item>
               </el-col>
            </el-row>
             <el-row>
               <el-col :span="24">
                <el-form-item label="所属部门" style="width:98%;">
                    <el-input v-model="form.department" placeholder="请输入所属部门"></el-input>
                 </el-form-item>
               </el-col>
               <el-col :span="24">
                <el-form-item label="职位名称" style="width:98%;">
                    <el-input v-model="form.jobname" placeholder="请输入职位名称"></el-input>
                </el-form-item>
               </el-col>
            </el-row>

             <el-row>
               <el-col :span="24">
                <el-form-item label="职位类型" style="width:98%;">
                    <el-input v-model="form.jobtype" placeholder="请输入职位类型"></el-input>
                </el-form-item>   
               </el-col>
               <el-col :span="24">
                <el-form-item label="拥有技能" style="width:98%;">
                    <el-input v-model="form.skills" placeholder="请输入拥有技能"></el-input>
                </el-form-item>  
               </el-col>
            </el-row>

            <el-form-item label="在职时间" style="width:99%">
                <el-col :span="11">
                <el-date-picker type="date" placeholder="开始时间" v-model="form.date1" style="width: 100%;"></el-date-picker>
                </el-col>
                <el-col class="line" :span="2">-</el-col>
               <el-col :span="11">
                <el-date-picker type="date" placeholder="结束时间" v-model="form.date2" style="width: 100%;"></el-date-picker>
                </el-col>
            </el-form-item>
             
            <el-form-item label="工作内容" style="width:99%">
                <el-input type="textarea" v-model="form.workcontent" rows="3px"></el-input>
            </el-form-item>

            <el-form-item> 
                <el-button @click="resetForm()" class="chongzhi">重置</el-button>
                <el-button type="primary" @click="submitForm()" class="button">立即添加</el-button>
            </el-form-item>
         </el-form>
    </div>
</template>

<script>
export default {
     data() {
      return {
        id:'',
        form: {
          companyname: '',
          department:'',
          industry: '',
          jobname:'',
          date1: '',
          date2: '',
          jobtype: '',
          skills:'',
          workcontent: '',
          id:''
        }
      }
    },

    methods:{
         //重置
         resetForm() {
            let a = this.form
            a.companyname = ''
            a.department = ''
            a.industry =  ''
            a.jobname = ''
            a.date1 =  ''
            a.date2 =  ''
            a.jobtype = ''
            a.skills = ''
            a.workcontent = ''
        },
        submitForm(){
          console.log(this.form);
          depot.post({
              url:'/empservice/practicejob/addPracticeJob',
              data:{
                'companyname':this.form.companyname,
                'department':this.form.department,
                'jobtype':this.form.jobtype,
                'industry':this.form.industry,
                'skills':this.form.skills,
                'workcontent':this.form.workcontent,
                'jobname':this.form.jobname,
                'starttoend':this.form.date1,
                // "id":this.form.id
              },
              cb:(res)=>{
                  console.log(res);
                if(res.code==20000){
                    alert(res.message)
                    this.$router.push("/PersonalResume")
                }else{
                    alert(res.message)
                }
                
              }
          })
        },
        goback(){
            this.$router.push("/PersonalResume")
        }
    },
    mounted:function(){
        // this.bus.$on('id',(res)=>{
        //     this.id = res
        //     console.log(this.id);
        // })
    }
}
</script>

<style lang="less" scoped>
.name{
    color: #353535;
    font-size: 23px;
    margin: 5px 10px;
}    
.button{
    margin-left: 163px;
    float: right;
    background-image: linear-gradient(#7a7878, #5a5a5a);
    border: none;
}
.chongzhi{
    float: left;
    margin-left: -75px;
}
.back11{
    font-size: 20px;
    margin-right: 55px;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    font-weight: 600;
    border-radius: 50%;
    margin-right: 30px;
}
</style>